/**
 * Author(s): xuming.Wong <xuming.Wong@gmail.com>
 */

#ifndef __QS_StockShareInfo_H__
#define __QS_StockShareInfo_H__

#include "Prerequisites.h"
#include "Utilities.h"

namespace QSThink
{
	enum StockShareChangeReason
	{

	};

	class StockShareChangeItem
	{
	public:
		StockShareChangeItem(int cd,int pd,int cr,qint64 tv,qint64 cv)
		{
			changeDay=cd;
			publicDay=pd;
			changeReason=cr;
			totalVolume=tv;
			currentVolume=cv;
			power=1;//power means this stock will change to
		}

		int changeDay;
		int publicDay;
		int changeReason;
		qint64 totalVolume;//10000
		qint64 currentVolume;

		float power;//now 1 stock equal to ? stock this day

	};

	class StockShareInfo
	{
	public:
		StockShareInfo(QString symbol);
		

		int changeCount()
		{
			return _changes.size();
		}

		StockShareChangeItem* getChangeItem(int index){
			return _changes[index];//
		}

		qint64 getTotalShareCount(QDate date);

		qint64 getTotalShareCount(int day);

		double getPower(int day);
	protected:
		bool loadFromFile();
		void calcStockShareWeightPower();
	protected:
		QString _symbol;

		std::vector<StockShareChangeItem*> _changes;

	};
}
#endif
